package com.fileCenter.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class LoginContextHolder {
	
	private static Log log = LogFactory.getLog(LoginContextHolder.class);

	private static ThreadLocal<LoginContext> local = new ThreadLocal<LoginContext>();
	
	public static LoginContext getLoginContext() {
		try {
			return local.get();
		} catch (Exception e) {
			log.error("get login info fail!");
		}
		return null;
	}
	
	public static void setLoginContext(LoginContext value) {
		try {
			local.set(value);
		} catch (Exception e) {
			log.error("set login info fail!");
		}
	}
	
	public static void removeLoginContext() {
		try {
			local.remove();
		} catch (Exception e) {
			log.error("remove login info fail!");
		}
	}
}
